//======================================================================================
//  Apache License, Version 2.0
//  Notes:Use this command to anonymously check out the latest project source code:
//  Non-members may check out a read-only working copy anonymously over HTTP.
//  SVN checkout http://YHHLineCommandWsp.googlecode.com/svn/trunk/ 
//
//  Author:		Kevin Yang
//  Email:		Bigearrabbit@qq.com
//
//  DATE:		2013-4-6
//
//  File Name:	YHHLineCommandParamDlg.cpp
//
//  Notes:
//
//======================================================================================

#include "YHHLineCommandParamDlg.h"
#include "CATApplicationFrame.h"
#include "CATDlgGridConstraints.h"
#include "CATMsgCatalog.h"
#ifdef YHHLineCommandParamDlg_ParameterEditorInclude
#include "CATIParameterEditorFactory.h"
#include "CATIParameterEditor.h"
#include "CATICkeParm.h"
#endif


//-------------------------------------------------------------------------
YHHLineCommandParamDlg::YHHLineCommandParamDlg() :
  CATDlgDialog ((CATApplicationFrame::GetApplicationFrame())->GetMainWindow(),
//CAA2 WIZARD CONSTRUCTOR DECLARATION SECTION
"YHHLineCommandParamDlg",CATDlgGridLayout
//END CAA2 WIZARD CONSTRUCTOR DECLARATION SECTION
                               )
{
//CAA2 WIZARD CONSTRUCTOR INITIALIZATION SECTION
 _Frame001 = NULL;
 _LabelName = NULL;
 _EditorName = NULL;
 _FrameDirandPoint = NULL;
 _Label013 = NULL;
 _SpinnerNormalDirX = NULL;
 _SpinnerNormalDirY = NULL;
 _SpinnerNormalDirZ = NULL;
 _Label018 = NULL;
 _Label019 = NULL;
 _Label020 = NULL;
 _LabelPoint = NULL;
 _SpinnerStartPointX = NULL;
 _SpinnerStartPointY = NULL;
 _SpinnerStartPointZ = NULL;
//END CAA2 WIZARD CONSTRUCTOR INITIALIZATION SECTION
 _SpinnerForValueChange = NULL;
}
//-------------------------------------------------------------------------
YHHLineCommandParamDlg::~YHHLineCommandParamDlg()
{
//  Do not delete the control elements of your dialog: 
//     this is done automatically
//  --------------------------------------------------
//CAA2 WIZARD DESTRUCTOR DECLARATION SECTION
 _Frame001 = NULL;
 _LabelName = NULL;
 _EditorName = NULL;
 _FrameDirandPoint = NULL;
 _Label013 = NULL;
 _SpinnerNormalDirX = NULL;
 _SpinnerNormalDirY = NULL;
 _SpinnerNormalDirZ = NULL;
 _Label018 = NULL;
 _Label019 = NULL;
 _Label020 = NULL;
 _LabelPoint = NULL;
 _SpinnerStartPointX = NULL;
 _SpinnerStartPointY = NULL;
 _SpinnerStartPointZ = NULL;
//END CAA2 WIZARD DESTRUCTOR DECLARATION SECTION
 _SpinnerForValueChange = NULL;//set null
}
//---------------------------------------------------------
void YHHLineCommandParamDlg::Build()
{
//  TODO: This call builds your dialog from the layout declaration file
//  -------------------------------------------------------------------

//CAA2 WIZARD WIDGET CONSTRUCTION SECTION
 SetGridColumnResizable(0,1);
 _Frame001 = new CATDlgFrame(this, "Frame001", CATDlgGridLayout);
_Frame001 -> SetGridConstraints(0, 0, 1, 1, CATGRID_4SIDES);
 _Frame001 -> SetGridColumnResizable(1,1);
 _LabelName = new CATDlgLabel(_Frame001, "LabelName");
_LabelName -> SetGridConstraints(0, 0, 1, 1, CATGRID_4SIDES);
 _EditorName = new CATDlgEditor(_Frame001, "EditorName");
_EditorName -> SetGridConstraints(0, 1, 1, 1, CATGRID_4SIDES);
 _FrameDirandPoint = new CATDlgFrame(this, "FrameDirandPoint", CATDlgGridLayout);
_FrameDirandPoint -> SetGridConstraints(1, 0, 1, 1, CATGRID_4SIDES);
 _FrameDirandPoint -> SetGridColumnResizable(1,1);
 _FrameDirandPoint -> SetGridColumnResizable(2,1);
 _FrameDirandPoint -> SetGridColumnResizable(3,1);
 _Label013 = new CATDlgLabel(_FrameDirandPoint, "Label013");
_Label013 -> SetGridConstraints(1, 0, 1, 1, CATGRID_4SIDES);
 _SpinnerNormalDirX = new CATDlgSpinner(_FrameDirandPoint, "SpinnerNormalDirX", CATDlgSpnEntry|CATDlgSpnDouble);
 _SpinnerNormalDirX -> SetMinMaxStep(0.000000, 1000.000000, 1.000000);
 _SpinnerNormalDirX -> SetUnit (CATDlgControl::Millimeter);
 _SpinnerNormalDirX -> SetMagnitude (CATDlgControl::Length);
 _SpinnerNormalDirX -> SetPrecision( 0 );
_SpinnerNormalDirX -> SetGridConstraints(1, 1, 1, 1, CATGRID_4SIDES);
 _SpinnerNormalDirY = new CATDlgSpinner(_FrameDirandPoint, "SpinnerNormalDirY", CATDlgSpnEntry|CATDlgSpnDouble);
 _SpinnerNormalDirY -> SetMinMaxStep(0.000000, 10.000000, 1.000000);
 _SpinnerNormalDirY -> SetUnit (CATDlgControl::Millimeter);
 _SpinnerNormalDirY -> SetMagnitude (CATDlgControl::Length);
 _SpinnerNormalDirY -> SetPrecision( 0 );
_SpinnerNormalDirY -> SetGridConstraints(1, 2, 1, 1, CATGRID_4SIDES);
 _SpinnerNormalDirZ = new CATDlgSpinner(_FrameDirandPoint, "SpinnerNormalDirZ", CATDlgSpnEntry|CATDlgSpnDouble);
 _SpinnerNormalDirZ -> SetMinMaxStep(0.000000, 10.000000, 1.000000);
 _SpinnerNormalDirZ -> SetUnit (CATDlgControl::Millimeter);
 _SpinnerNormalDirZ -> SetMagnitude (CATDlgControl::Length);
 _SpinnerNormalDirZ -> SetPrecision( 0 );
_SpinnerNormalDirZ -> SetGridConstraints(1, 3, 1, 1, CATGRID_4SIDES);
 _Label018 = new CATDlgLabel(_FrameDirandPoint, "Label018");
_Label018 -> SetGridConstraints(0, 1, 1, 1, CATGRID_CENTER);
 _Label019 = new CATDlgLabel(_FrameDirandPoint, "Label019");
_Label019 -> SetGridConstraints(0, 2, 1, 1, CATGRID_CENTER);
 _Label020 = new CATDlgLabel(_FrameDirandPoint, "Label020");
_Label020 -> SetGridConstraints(0, 3, 1, 1, CATGRID_CENTER);
 _LabelPoint = new CATDlgLabel(_FrameDirandPoint, "LabelPoint");
_LabelPoint -> SetGridConstraints(2, 0, 1, 1, CATGRID_4SIDES);
 _SpinnerStartPointX = new CATDlgSpinner(_FrameDirandPoint, "SpinnerStartPointX", CATDlgSpnEntry|CATDlgSpnDouble);
 _SpinnerStartPointX -> SetMinMaxStep(0.000000, 1000.000000, 1.000000);
 _SpinnerStartPointX -> SetUnit (CATDlgControl::Millimeter);
 _SpinnerStartPointX -> SetMagnitude (CATDlgControl::Length);
 _SpinnerStartPointX -> SetPrecision( 0 );
_SpinnerStartPointX -> SetGridConstraints(2, 1, 1, 1, CATGRID_4SIDES);
 _SpinnerStartPointY = new CATDlgSpinner(_FrameDirandPoint, "SpinnerStartPointY", CATDlgSpnEntry|CATDlgSpnDouble);
 _SpinnerStartPointY -> SetMinMaxStep(0.000000, 10.000000, 1.000000);
 _SpinnerStartPointY -> SetUnit (CATDlgControl::Millimeter);
 _SpinnerStartPointY -> SetMagnitude (CATDlgControl::Length);
 _SpinnerStartPointY -> SetPrecision( 0 );
_SpinnerStartPointY -> SetGridConstraints(2, 2, 1, 1, CATGRID_4SIDES);
 _SpinnerStartPointZ = new CATDlgSpinner(_FrameDirandPoint, "SpinnerStartPointZ", CATDlgSpnEntry|CATDlgSpnDouble);
 _SpinnerStartPointZ -> SetMinMaxStep(0.000000, 10.000000, 1.000000);
 _SpinnerStartPointZ -> SetUnit (CATDlgControl::Millimeter);
 _SpinnerStartPointZ -> SetMagnitude (CATDlgControl::Length);
 _SpinnerStartPointZ -> SetPrecision( 0 );
_SpinnerStartPointZ -> SetGridConstraints(2, 3, 1, 1, CATGRID_4SIDES);
//END CAA2 WIZARD WIDGET CONSTRUCTION SECTION

//this is only for value change agent
_SpinnerForValueChange = new CATDlgSpinner(_FrameDirandPoint, "SpinnerForValueChange", CATDlgSpnEntry|CATDlgSpnDouble);
_SpinnerForValueChange -> SetMinMaxStep(-10.0, 10.0, 1.0);//set range
_SpinnerForValueChange->SetVisibility(CATDlgHide);//hide


//CAA2 WIZARD CALLBACK DECLARATION SECTION
//END CAA2 WIZARD CALLBACK DECLARATION SECTION
     AddAnalyseNotificationCB (this, 
                               GetWindCloseNotification(),
                               (CATCommandMethod)&YHHLineCommandParamDlg::OnYHHLineCommandParamDlgWindCloseNotification,
                               NULL);
     AddAnalyseNotificationCB (this, 
                               GetDiaCANCELNotification(),
                               (CATCommandMethod)&YHHLineCommandParamDlg::OnYHHLineCommandParamDlgDiaCANCELNotification,
                               NULL);
     AddAnalyseNotificationCB (this, 
                               GetDiaOKNotification(),
                               (CATCommandMethod)&YHHLineCommandParamDlg::OnYHHLineCommandParamDlgDiaOKNotification,
                               NULL);

}
//-------------------------------------------------------------------------
void YHHLineCommandParamDlg::OnYHHLineCommandParamDlgDiaOKNotification(CATCommand* cmd, CATNotification* evt, CATCommandClientData data)
{
  // Add your code here
	SetVisibility(CATDlgHide);
}
//-------------------------------------------------------------------------
void YHHLineCommandParamDlg::OnYHHLineCommandParamDlgDiaCANCELNotification(CATCommand* cmd, CATNotification* evt, CATCommandClientData data)
{
	SetVisibility(CATDlgHide);//hide only
}
//-------------------------------------------------------------------------
void YHHLineCommandParamDlg::OnYHHLineCommandParamDlgWindCloseNotification(CATCommand* cmd, CATNotification* evt, CATCommandClientData data)
{
	SetVisibility(CATDlgHide);//hide only
}
//-------------------------------------------------------------------------

